<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSocialEnergyContentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('social_energy_contents', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->enum('content_type', ['encouragement', 'suggestion', 'tip']);
            $table->string('title', 200)->nullable();
            $table->text('content');
            $table->enum('target_ability', ['breaking_ice', 'empathy', 'conversation_flow', 'general'])->nullable();
            $table->text('trigger_condition')->nullable()->comment('触发条件(JSON字符串)');
            $table->boolean('is_active')->default(true);
            $table->timestamp('created_at')->useCurrent();
            
            // 索引
            $table->index(['content_type']);
            $table->index(['target_ability']);
            $table->index(['is_active']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('social_energy_contents');
    }
}